#pragma once

extern void *__per_cpu_ptr(void *ptr, int cpu);

#define per_cpu_ptr(ptr, cpu) ((__typeof__(ptr))__per_cpu_ptr((void *)(ptr), (cpu)))

#define raw_cpu_ptr(ptr)                      \
    ({                                        \
        void *__p = (void *)ptr;              \
        per_cpu_ptr(__p, smp_processor_id()); \
    })

#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
